package com.wensen.biz;

import com.wensen.entity.BankInfo;
import com.wensen.mapper.BankInfoMapper;
import com.wensen.service.BankInfoSerivce;
import io.seata.spring.annotation.GlobalTransactional;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

import java.util.Date;


@RestController
@RefreshScope
@RequestMapping("/product")
public class ProductController {

    @Value("${info}")
    private String info;


    @Autowired
    private BankInfoSerivce bankInfoSerivce;


    @RequestMapping(value = "/getInfo")
    @GlobalTransactional(rollbackFor = Exception.class)
    @ResponseBody
    public String getProductInfo(){
        System.out.println("正在执行===="+new Date());
        try{
            bankInfoSerivce.updateBankInfo(1);
            Thread.sleep(2000);
        }catch (Exception e){
            e.printStackTrace();
        }
        return info;
    }
}
